Fix failure on second run of 'cargo test'
authorBrian Koropoff <bkoropoff@gmail.com>
Sun, 20 Jul 2014 22:11:41 +0000 (15:11 -0700)
committerBrian Koropoff <bkoropoff@gmail.com>
Sun, 20 Jul 2014 22:11:41 +0000 (15:11 -0700)
Generate the right target filename for rlibs built in test
mode so that they are correctly moved back out of the old-root
directory.

src/cargo/ops/cargo_rustc/context.rs

index 341be4c5aa96c26bf395ba828cda05d5134cbd62..cdaa1fcd1d7ba7b9f1079806215bae9ba9ff2d2b 100644 (file)
@@ -180,7 +180,11 @@ impl<'a, 'b> Context<'a, 'b> {
             ret.push(format!("{}{}{}", prefix, stem, suffix));
         }
         if target.is_rlib() {
-            ret.push(format!("lib{}.rlib", stem));
+            if target.get_profile().is_test() {
+                ret.push(format!("{}{}", stem, self.target_exe));
+            } else {
+                ret.push(format!("lib{}.rlib", stem));
+            }
         }
         if target.is_bin() {
             ret.push(format!("{}{}", stem, self.target_exe));